<?php
/**
 * Created by PhpStorm.
 * User: D
 * Date: 2019/5/10
 * Time: 20:29
 */

header("Content-Type:application/json;charset=utf-8");
header("Access-Control-Allow-Origin:*");
include "dbHelper.php";

if($_SERVER["REQUEST_METHOD"] == "POST"){
    if((isset($_REQUEST["uname"]) && isset($_REQUEST["upwd"]))){
        $UNAME = $_POST["uname"];
        $UPWD = $_POST["upwd"];
        $UTEL = $_POST["utel"];
        $UEMAIL = $_POST["uemail"];
        $sql = "INSERT INTO `userinfo1`(`u_name`,`u_pwd`,`u_tel`,`u_email`)
VALUES ('" . $UNAME . "','" . $UPWD . "','" . $UTEL . "','" . $UEMAIL . "')";
        // print_r($sql);
        $result = dbHelper($sql);
        // print_r($result);

        if($result >= 1){
            print_r(json_encode(Array("msg" => "注册成功", "status" => 1)));
        } else {
            print_r(json_encode(Array("msg" => "注册失败", "status" => 0)));
        }

    }

} else {
    print_r(json_encode(Array("msg" => "不支持get请求", "status" => -1)));
}